/*
 * @(#)AbstractConnection.java   09/10/15
 * 
 * Copyright (C) 2009 Ecole des Mines d'Ales
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact: yulinz88@gmail.com
 */



package fr.ema.arch3d.model.architecture.specification;

import fr.ema.arch3d.model.architecture.textADL.ADLDoc;

import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.factory.InstantiationException;

//~--- classes ----------------------------------------------------------------

/**
 * Class description
 *
 *
 * @version        1.0, 09/09/13
 * @author         Huaxi (Yulin) ZHANG
 */
public abstract class AbstractConnection implements Connection {

    /** the connected client component role */
    private AbstractComponentRole clientCmpRole;

    /** the ADL description document of connection */
    private ADLDoc doc;

    /** the connected client interface */
    private String itfClientName;

    /** the connected  server interface */
    private String itfServerName;

    /** the name of this component role */
    private String name;

    /** the connected server component role */
    private AbstractComponentRole serverCompRole;

    /**
     * Constructs the connection with all its required information.
     * @param name the connection name.
     * @param itfClientName  the name of client interface
     * @param clientCmpRole  the connected client component role.
     * @param itfServerName  the name of server interface
     * @param serverCmpRole  the connected server component role.
     * @throws InstantiationException throw exception
     * @throws NoSuchInterfaceException  throw exception
     */
    public AbstractConnection(String name, String itfClientName, AbstractComponentRole clientCmpRole,
                              String itfServerName, AbstractComponentRole serverCmpRole)
            throws InstantiationException, NoSuchInterfaceException {
        this.name           = name;
        this.itfClientName  = itfClientName;
        this.itfServerName  = itfServerName;
        this.clientCmpRole  = clientCmpRole;
        this.serverCompRole = serverCmpRole;
    }

    /**
     * Getter of the property <tt>doc</tt>
     *
     * @return  the doc
     */
    public ADLDoc getDoc() {
        return this.doc;
    }

    /**
     * Setter of the property <tt>doc</tt>
     *
     * @param doc  the doc to set
     */
    public void setDoc(ADLDoc doc) {
        this.doc = doc;
    }

    /**
     * Getter of the property <tt>clientCmpRole</tt>
     *
     * @return  the clientCmpRole
     */
    public AbstractComponentRole getClientCmpRole() {
        return this.clientCmpRole;
    }

    /**
     * Getter of the property <tt>itfClientName</tt>
     *
     * @return  the itfClientName
     */
    public String getItfClientName() {
        return this.itfClientName;
    }

    /**
     * Getter of the property <tt>itfServerName</tt>
     *
     * @return  the itfServerName
     */
    public String getItfServerName() {
        return this.itfServerName;
    }

    /**
     * Getter of the property <tt>name</tt>
     *
     * @return  the name
     */
    public String getName() {
        return this.name;
    }

    /**
     * Getter of the property <tt>serverCompRole</tt>
     *
     * @return  the serverCompRole
     */
    public AbstractComponentRole getServerCompRole() {
        return this.serverCompRole;
    }
}
